<?php $this->load->view("common/header") ?>
<body>
<?php  

/*
foreach($report_parent as $r)
{
	dump($r[0]['company_name']);	
}
*/


?>
  <div id="page_wrapper">
<?php $this->load->view("common/speel") ?>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td align="left"><form name="form1" method="post" action="<?php echo base_url() ."report/client_hours" ?>">
        <table width="500" border="0" align="left" cellpadding="3" cellspacing="3">
          <tr>
         	<td colspan="4"><span class="welcomeMsg">Report :: Client Reports :: Hours Logged Per Client</span></td>
         </tr>
         
          <tr>
            <td width="67" align="left" class="tbl_field_lable">Start date</td>
            <td width="144"><input type="text" name="report_start" id="report_start"></td>
            <td width="144"><input name="report_start_time" type="text" id="jog_start_time" value="00:00"></td>
            <td width="105" align="left" class="tblBodyNoneHover"><input name="action" type="submit" class="tblBtn" id="action" value=" Build Report "></td>
          </tr>
          <tr>
            <td align="left" class="tbl_field_lable">End date</td>
            <td><input type="text" name="report_end" id="report_end"></td>
            <td><input name="report_end_time" type="text" id="jog_end_time" value="23:59"></td>
            <td align="right" class="tblBodyNoneHover">&nbsp;</td>
          </tr>
      </table>
      </form>


      </td>
    </tr>
    <tr>
      <td align="left">
      <?php if(!empty($report_parent)) { ?><br>
<br>
        <table width="95%" border="0" align="left" cellpadding="2" cellspacing="0">
        <tr class="tblSubHeader">
          <td class="tbl_header"><strong>Client Reports : Hours Logged per client</strong> for the period of '<?php echo $s ?>' to '<?php echo $e ?>'</td>
        </tr>
        <tr>
          <td><table width="99%" border="0" align="center" cellpadding="5" cellspacing="0">
            <tr class="panelHeaderBgColor">
              <td width="24%" class="tbl_row_header">Client</td>
              <td width="31%" class="tbl_row_header">Hours logged</td>
              <td width="40%" class="tbl_row_header">Number of jobs</td>
              <td width="5%" class="tbl_row_header">&nbsp;</td>
            </tr>
            <?php foreach($report_parent as $r)
			  { 
			   ?>
            <tr bgcolor="" class="reportTr1">
              <td bgcolor="" class="tbl_row"><?php echo $r[0]['company_name'] ?></td>
              <td class="tbl_row"><?php echo format_hours_logged($r[0]['spent2']) ?></td>
              <td bgcolor="" class="tbl_row"><?php echo $r[0]['numJobs'] ?></td>
              <td align="center" bgcolor="" class="borderBot"><a href="javascript:;" class="reportTr1" onClick="togEle('jobD_<?php echo $r[0]['id'] ?>')">Details</a></td>
            </tr>
            <tr id="jobD_<?php echo $r[0]['id'] ?>" style="display:none">
              <td colspan="4"><table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" rules="groups">
                <tr class="tbl_row_header">
                  <td align="left">Job #</td>
                  <td align="center">Invo'd</td>
                  <td align="left">Client</td>
                  <td align="left">Job Subject</td>
                  <td align="left">Type/Pri</td>
                  <td align="left">Start Time</td>
                  <td align="left">End time</td>
                  <td align="left">Hours</td>
                  <td align="left"> User</td>
                </tr>
                <?php foreach($r[1] as $job) { 
	$trClass = "tblBody";

?>
                <tr class="tbl_row">
                  <td width="47" align="left" ><span class=""><?php echo $job['id'] ?></span></td>
                  <td width="51" align="center" ><input class="job_invoiced" name="job_invoiced" type="checkbox" id="job_invoiced" <?php if($job['job_invoiced'] == "1") { echo " checked"; }   ?> data="<?php echo $job['id'] ?>"></td>
                  <td width="218"  align="left" ><span class=""><?php echo $job['company_name'] ?></span></td>
                  <td width="329"  align="left" ><span class=""><?php echo $job['job_subject'] ?></span></td>
                  <td width="140" align="left" ><span class=""><?php echo $job['job_type'] ?> / <?php echo $job['job_pri'] ?></span></td>
                  <td width="182" align="left" ><span class=""><?php echo format_job_time($job['job_start']) ?></span></td>
                  <td width="204" align="left" ><span class=""><?php echo format_job_time($job['job_end']) ?></span></td>
                  <td width="70" align="left" ><span class=""><?php echo $job['spent2'] ?></span></td>
                  <td width="139"  align="left" ><span class=""><?php echo $job['firstname']." ".$job['lastname']   ?></span></td>
                </tr>
                <?php } ?>
              </table></td>
            </tr>
            <tr style="display:none">
              <td colspan="4">&nbsp;</td>
            </tr>
            <?php } ?>
          </table></td>
        </tr>
      </table>
      <?php } ?>
      </td>
    </tr>
</table>
<div class="ajaxFlashMsg" id="reportNoti" align="center" style="display:none;"><strong>Updated!</strong></div>
<br><br>


<?php $this->load->view("common/footer") ?>
</div>
</body>
</html>
